//
// Created by Administrator on 2022/10/24.
//
#include <iostream>
#include<cstdlib>
#include <vector>
#include <algorithm>
#include<ctime>


//void swap(int &a, int &b)
//{
//    int t = a;
//    a = b;
//    b = t;
//}

void randomArr(int *arrP, int n)
{
    srand((int) time(0));
    for (int i = 0; i < n; i++)
        arrP[i] = rand();
}

bool checkSort(int *arr, int n)
{
    for (int i = 0; i < n - 1; i++)
    {
        if (arr[i] > arr[i + 1])
            return false;
    }
    return true;
}


void printArr(int *arrP, int n)
{
    for (int i = 0; i < n; ++i)
        printf("%d ", *arrP++);
    printf("\n");
}


void printVector(std::vector<int> a)
{
    for (int i:a)
    {
        printf("%d ", i);
    }
    printf("\n");
}

/// \param a vector<int>
/// \param one: one index
/// \param two: another index
void swapVector(std::vector<int> &a, int one, int two)
{
    int t = a[one];
    a[one] = a[two];
    a[two] = t;
}

void randVector(std::vector<int> &v, int n)
{
    srand((int) time(0));
    v.clear();
    for (int i = 0; i < n; ++i)
    {
        v.push_back(rand());
    }
}

bool checkSortVector(std::vector<int> v)
{
    std::vector<int> vv = v;
    sort(v.begin(), v.end());
    for (int i = 0; i < v.size(); ++i)
    {
        if (v[i] != vv[i])
            return false;
    }
    return true;
}

bool isInVector(std::vector<int> v, int x)
{
    for (int i = 0; i < v.size(); ++i)
    {
        if (v[i]==x)
            return true;
    }
    return false;
}


